package miniprojet.jeux.modele;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;

@Entity
public class Tour implements Serializable {

	private int idTour;
	private int numero;
	private Collection<Match> matchs;

	public Tour() {
		matchs = new ArrayList<Match>();
	}

	@Id
	@GeneratedValue
	public int getIdTour() {
		return idTour;
	}

	public void setIdTour(int idTour) {
		this.idTour = idTour;
	}

	public int getNumero() {
		return numero;
	}

	public void setNumero(int numero) {
		this.numero = numero;
	}

	@OrderBy("numero ASC")
	@OneToMany
	public Collection<Match> getMatchs() {
		return matchs;
	}

	public void setMatchs(Collection<Match> matchs) {
		this.matchs = matchs;
	}

	public void addMatch(Match match) {
		matchs.add(match);
	}

}
